<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			function cal(type) {
				var num1 = document.getElementById("firstNum").value ;
				var num2 = document.getElementById("secondNum").value ;
                var result;
                switch (type){
                	case "+":
                	result = parseInt(num1) + parseInt(num2);
                		break;
                	case "-":
                	result = parseInt(num1) - parseInt(num2);
                		break;
                	case "*":
                	result = parseInt(num1) * parseInt(num2);
                		break;
                	case "/":
                	result = parseInt(num1) / parseInt(num2);
                		break;
                	default:
                		break;
                }
                document.getElementById("endNum").value = result;
			}
		</script>
		<link rel="stylesheet" href="../lib/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
	</head>
	<body>
		<table>
			<tr>
				<td>
					<img src="../img/UODJC[}VYOB`V{5V~JKNZAG.png">
				</td>
				<th>
					购物简易计算器
				</th>
			</tr>
			<tr>
				<th>第一个数</th>
				<td >
					<input id="firstNum" type="text">
				</td>
			</tr>
			<tr>
				<th>第二个数</th>
				<td >
					<input id="secondNum" type="text">
				</td>
			</tr>
			<tr>
				<td>
					<input type="button" value="+" onclick="cal(this.value)">
				</td>
				<td>
					<input type="button" value="-" onclick="cal(this.value)">
					<input type="button" value="*" onclick="cal(this.value)">
					<input type="button" value="/" onclick="cal(this.value)">
				</td>
			</tr>
			<tr>
				<th>计算结果</th>
				<td >
					<input id="endNum" type="text">
				</td>
			</tr>
		</table>
		<script type="text/javascript" src="../lib/jquery/jquery-1.11.1.js" ></script>
		<script type="text/javascript" src="../lib/bootstrap-3.3.7-dist/js/bootstrap.min.js" ></script>
	</body>
</html>
